import React, { Component } from "react";
import XzButton from "./components/XzButton";

export default class App extends Component {
  // 状态变量
  state = {
    showChild: false, //是否显示子组件XzButton
  };
  render() {
    return (
      <div>
        <h2>这里是根组件APP</h2>
        <button
          onClick={() => this.setState({ showChild: !this.state.showChild })}
        >
          挂载/卸载XzButton子组件
        </button>
        <hr />
        {this.state.showChild && <XzButton></XzButton>}
      </div>
    );
  }
}
